/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedBean.TX.Rep;

import session.TX.CustomerReservationSBRemote;
import session.TX.DishManagerSBRemote;
import session.TX.OutletSBRemote;
import session.TX.StakeholderAccountsSBRemote;
import session.TX.UsersSBRemote;
import managedBean.TX.CustomerIOTRPortal.FakeMainPortalMB;
import entity.tx.FoodItem;
import entity.establishment.OutletFood;
import entity.establishment.Stakeholder;
import entity.tx.Users;
import helper.tx.Helper_OutletReservation;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author Lu Xiaodi
 */
@ManagedBean(name = "displayManagedBeanRep")
@RequestScoped
public class DisplayManagedBeanRepMB {

    @ManagedProperty(value = "#{fakeMainPortalMB}")
    private FakeMainPortalMB portalManagedBean;
    @EJB
    StakeholderAccountsSBRemote stakeholderBean;
    @EJB
    DishManagerSBRemote dishBean;
    @EJB
    OutletSBRemote outletBean;
    @EJB
    UsersSBRemote usersBean;
    @EJB
    CustomerReservationSBRemote reservationBean;
    String outletName;
    String email;

    /** Creates a new instance of DisplayManagedBeanRepMB */
    public DisplayManagedBeanRepMB() {
    }

    public List<Helper_OutletReservation> getReservationByCust() {
        return reservationBean.getCurrentReservationsByCustomer(email);
    }

    public List<Users> getAllUsers() {
        return usersBean.getAllUser();
    }

    public List<Stakeholder> getAllStakeholder() {
        return stakeholderBean.getAllStakeholders();
    }

    public List<OutletFood> getAllOutlets() {
        return outletBean.getAllOutlets();
    }

    public List<FoodItem> getFeaturedDishes() {
        if (portalManagedBean.getOutletId() == null) {
            return null;
        }
        return outletBean.getFeaturedFoodItems(portalManagedBean.getOutletId());
    }

    public OutletFood getOutlet() {
        if (portalManagedBean.getOutletId() == null) {
            return null;
        }
        return outletBean.getOutlet(portalManagedBean.getOutletId());
    }

    public String getOutletName() {
        return outletName;
    }

    public void setOutletName(String outletName) {
        this.outletName = outletName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @param portalManagedBean the portalManagedBean to set
     */
    public void setPortalManagedBean(FakeMainPortalMB portalManagedBean) {
        this.portalManagedBean = portalManagedBean;
    }
}
